import React from 'react';

// 引入路由相应的API
import { BrowserRouter, useRoutes } from 'react-router-dom';

// 获取所有的页面路由
import routes from '~react-pages';

const App = () =>
{
    // 封装验证路由
    const Routers = () =>
    {
        // 获取当前路径
        const { pathname } = useLocation();

        useEffect(() => {

        },[pathname]);

        return (
            <React.Suspense fallback={<React.UI.AutoCenter><React.UI.DotLoading color='primary' /></React.UI.AutoCenter>}>
                {useRoutes(routes)}
            </React.Suspense>
        )
    }

    return (
        <BrowserRouter>
            <Routers />
        </BrowserRouter>
    );
}

export default App;
